<?php

namespace Hilaoyu\LaravelExtend\Services\Realnames\Controllers;

use Hilaoyu\LaravelExtend\ControllerBaseResource;
use Hilaoyu\LaravelExtend\Services\Auth\AuthService;
use Hilaoyu\LaravelExtend\Services\Realnames\RealnamesEntity;
use Illuminate\Http\Request;

class RealnamesController extends ControllerBaseResource
{
    protected function entity()
    {
        return new RealnamesEntity();
    }


    protected function alterModelSaveData(Request $request, $id = '')
    {
        $data = $request->only([
           'user_id',
           'name',
           'card_type',
           'card_no',
           'card_img',
           'user_img',
           'remark',
        ]);

        if(!data_get($data,'user_id','')){
            $data['user_id'] = AuthService::AuthenticatedUser();
        }

        return $data;
    }


}
